
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport"
	content="width=device-width, initial-scale=1, maximum-scale=1">
<title>后台管理</title>
<link rel="stylesheet" href="../layui/layui/css/layui.css">
</head>
<body class="layui-layout-body">


	<form class="layui-form">
		<!-- 提示：如果你不想用form，你可以换成div等任何一个普通元素 -->
		<div class="layui-form-item">
			<label class="layui-form-label">产品种类</label>
			<div class="layui-input-block">
				<input type="text" id="zl" name="zl" placeholder="请输入"
					autocomplete="off" class="layui-input">
			</div>

		</div>


		<div class="layui-form-item">
			<div class="layui-input-block">
				<button class="layui-btn" lay-submit lay-filter="sub">立即提交</button>
				<button type="reset" class="layui-btn layui-btn-primary">重置</button>
			</div>
		</div>
		<!-- 更多表单结构排版请移步文档左侧【页面元素-表单】一项阅览 -->
	</form>


	<script src="../layui/layui/layui.js"></script>

	<script src="../js/jquery-1.8.2.js"></script>
	<script type="text/javascript">
		function getQueryString(name) {
			var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
			var url = decodeURI(decodeURI(window.location.search))
			var r = url.substr(1).match(reg);
			if (r != null)
				return unescape(r[2]);
			return null;
		}
		$(document).ready(function() {
			var id = getQueryString("id");
			var zl = getQueryString("zl");
			
			
			//方法一 :query赋值
			
			$("#zl").val(zl);
			
			
			
			
		});
	</script>
	<script>
		//JavaScript代码区域
		
		layui.use([ 'form', 'table','element','layer' ], function() {
			var form = layui.form;
			var table = layui.table;
			var layer = layui.layer;
			var element=layui.element;
			var $ = layui.$;

			//submit提交事件
			form.on('submit(sub)', function(data) {
				console.log(data.field) //当前容器的全部表单字段，名值对形式：{name: value}
				var id = getQueryString("id");
				data.field.id = id;
				$.ajax({
					url : "../zhlup",
					type : "get",
					data : data.field,
					success : function(res) {

						layer.msg(res.msg);

					},

				});

				return false; //阻止表单跳转。如果需要表单跳转，去掉这段即可。
			});

		})
	</script>
</body>
</html>